/* Copyright (c) 2010, Peter Lényi */
/* Licensed under The BSD License. */

package gem.apps.fs.web.style;

/**
 * Class StyleFactory produces instances of Style class.
 * 
 * @author Peter Lényi
 * @version 20100426F
 */
public class StyleFactory
{
    private static StyleFactory instance = null;

    private StyleFactory() { /* SINGLETON, FACTORY METHOD PATTERNS */ }

    public static StyleFactory getInstance() {
        if (instance == null) {
            instance = new StyleFactory();
        }
        return instance;
    }

    public Style getStyle() {
        Style result = null;
        try {
            Class c = Class.forName("gem.apps.fs.web.style.DefaultStyle");
            result = (Style) c.newInstance();
        }
        catch (ClassNotFoundException ex) {
            ex.printStackTrace(System.err);
        }
        catch (InstantiationException ex) {
            ex.printStackTrace(System.err);
        }
        catch (IllegalAccessException ex) {
            ex.printStackTrace(System.err);
        }
        catch (ClassCastException ex) {
            ex.printStackTrace(System.err);
        }
        return result;
    }
}
